package com.baidu.treadCommunication;

public class DrawMoneyThread extends Thread{
    private String threadName;
    private double money;
    private Account account;

    public DrawMoneyThread() {
    }

    //1.创建有参构造器
    public DrawMoneyThread(String threadName, Account account, double money) {
        this.threadName = threadName;
        this.money = money;
        this.account = account;
    }

    @Override
    public void run() {
        super.setName(this.threadName);
        //1.不断遍历取钱操作
        while (true){
            try {
                account.drawMoney(money);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
